<?php

namespace app\api\controller;

use app\common\model\node\NodeProcessModel;
use app\common\model\offer\CustomerGoodsDesertModel;
use app\common\model\offer\GoodsDetailModel;
use app\common\model\offer\GoodsModel;
use app\common\model\warning\MemberLogModel;
use app\common\model\warning\MemberModel;
use helper\Arr;
use helper\Http;
use think\facade\Db;
use wechat\Factory;

class GoodsController extends Base
{

    private $goodsModel;
    /**
     * 构造方法
     * @access public
     * @throws \Exception
     */
    public function __construct()
    {
        parent::__construct();
        $this->goodsModel = new GoodsModel();

    }

    /**
     * 获取商品报价组及组内商品
     */
    public function getGoodsList(){
        $goods = $this->goodsModel->where('pid', 0)->select();
        //$goods = $this->goodsModel->goodsList();
        $this->result($goods);
    }

    public function goodsDetailList(){
        $goodsDetailModel = new GoodsDetailModel();
        $ids= $this->request->param('ids');
        $goodsList = $goodsDetailModel->where('goods_config_id','in',$ids)->select()->toArray();
        $goodsList = $goodsDetailModel->_formatList($goodsList);
        $goodsList = Arr::group($goodsList,'goods_config_id');
        $this->result($goodsList);
    }










}
